package com.hyt.it.ogt.pj.mapper;

import java.util.List;
import java.util.Set;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hyt.it.ogt.pj.model.entity.PieceScore;
import com.hyt.it.ogt.pj.model.vo.OptionItemVo;
import com.hyt.it.ogt.pj.model.vo.PipceScoreVo;
import com.hyt.it.ogt.pj.model.vo.TaskPageItemVo;
import com.hyt.model.PageParam;

/**
 * <p>
 * 评卷块分数表 Mapper 接口
 * </p>
 *
 * @author qiaozj
 * @since 2020-07-09
 */
public interface PieceScoreMapper extends BaseMapper<PieceScore> {

    void deleteStuScoreBySubjectIdAndPieceIdAndEncodeId(
    		@Param("subjectId")String subjectId, 
    		@Param("pieceId")String pieceId, 
    		@Param("encodeId")String encodeId);

    
    void deleteStuScoreBySubjectIdAndPieceIdAndEncodeIdAndUserid(
    		@Param("subjectId")String subjectId, 
    		@Param("pieceId")String pieceId, 
    		@Param("encodeId")String encodeId,
    		@Param("userId") String userId);
    
    
    /**
     * 删除分数块得分
     * @param admissionNumList
     * @param needRemoveTaskIdList
     * @return
     */
    boolean removePieceScore(List<String> admissionNumList, List<String> needRemoveTaskIdList);

    List<PipceScoreVo> getByPieceIds( @Param("pieceIds") String[] pieceIds);
    
    PieceScore getByPieceIdAndTaskIdAndEncodeId(
    		@Param("subjectId")String subjectId, 
    		@Param("pieceId")String pieceId, 
    		@Param("taskId")String taskId,   
    		@Param("encodeId")String encodeId,
    		@Param("userId")String userId);


    List<OptionItemVo> getExpertSubject(@Param("projectId")String projectId, @Param("officeId")String officeId);

    List<OptionItemVo> getExpertPlace(@Param("projectId")String projectId, @Param("officeId")String officeId);

    /**
     * 查询老师任务下的考生的人数
     * @param projectId
     * @param subjectId
     * @param userId
     * @return
     */
    int countStudentByUserId(
    		@Param("projectId") String projectId,
    		@Param("subjectId")  String subjectId,
    		@Param("userId") String userId,
    		@Param("batchId") String batchId,
    		@Param("placeId")String placeId,
    		@Param("roomId")String roomId);



    /**
     * 获取未评的学生试卷
     * @param projectId
     * @param subjectId
     * @param userId
     * @return
     */
    PieceScore getPieceScoreByProjectIdAndSubjectId(
    		@Param("projectId") String projectId,
    		@Param("subjectId") String subjectId,
    		@Param("userId") String userId);


    /**
     *
     * @param currUserId
     * @param projectId
     * @param subjectId
     * @param batchId
     * @param placeId
     * @param roomId
     * @return
     */
    PieceScore getPieceScoreByBatchIdAndPlaceIdAndRoomId(
    		@Param("userId")String currUserId, 
    		@Param("projectId")String projectId,
            @Param("subjectId") String subjectId, 
            @Param("batchId")String batchId,
            @Param("placeId")String placeId, 
            @Param("roomId")String roomId);

    /**
     * 获取考生的得分信息
     * @param projectId
     * @param subjectId
     * @param userId
     * @param admissionNum
     * @return
     */
    PieceScore getPieceScoreByAdmissioId(
    		@Param("projectId")String projectId, 
    		@Param("subjectId")String subjectId,
    		@Param("userId") String userId,
    		@Param("admissionNum") String admissionNum,
    		@Param("finish") Integer finish);


	/**
	 * 获取考生的得分信息
	 * @param projectId
	 * @param subjectId
	 * @param userId
	 * @param admissionNum
	 * @return
	 */
	PieceScore getPieceScoreByAdmissioIdAndUserId(
			@Param("projectId")String projectId,
			@Param("subjectId")String subjectId,
			@Param("userId") String userId,
			@Param("admissionNum") String admissionNum);


    /**
     * 获取评卷老师任务
     * @return
     */
    List<PieceScore> getPieceScoreByTaskId(@Param("taskId") String taskId, @Param("currUserId") String userId);
    
    
    PieceScore selectPieceScoreByTaskIdLimitOne(@Param("taskId") String taskId);


    /**
     * 获取评卷老师任务
     * @param projectId
     * @param subjectId
     * @param userId
     * @param batchId
     * @param placeId
     * @param roomId
     * @return
     */

    List<PieceScore> getPieceScoreByUserId(
    		@Param("projectId") String projectId,
    		@Param("subjectId") String subjectId,
    		@Param("currUserId") String userId,
    		@Param("batchId") String batchId,
    		@Param("placeId") String placeId,
    		@Param("roomId") String roomId);


    IPage<TaskPageItemVo> getPieceScorePage(PageParam<TaskPageItemVo> pageParam, @Param("currUserId")  String currUserId, @Param("projectId") String projectId,
                                              @Param("subjectId") String subjectId, @Param("batchId")  String batchId, @Param("placeId")  String placeId,
                                              @Param("roomId")  String roomId, @Param("name")  String name, @Param("examState")  String examState,
                                              @Param("absentState") String absentStates, @Param("anonymous") String anonymous, Set<String> admissionNums, String order, String sort);


	


}
